widget: Draw debug nodes for widget margins too
authorTimm Bäder <mail@baedert.org>
Tue, 4 Jul 2017 13:06:18 +0000 (15:06 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:15 +0000 (21:27 -0400)
gtk/gtkwidget.c

index bc716c3fe62233e10a13389deaa3df375b82a1de..dda485691c07858c9f12165dd7c8098ce8753d7d 100644 (file)
@@ -15134,20 +15134,43 @@ gtk_widget_maybe_add_debug_render_nodes (GtkWidget             *widget,
   GtkCssStyle *style;
   GtkBorder margin, border, padding;
 
-  /* We should be offset to the widget allocation at this point */
+  /* We should be offset to priv->allocation at this point */
 
   if (GTK_DISPLAY_DEBUG_CHECK (display, LAYOUT))
     {
       graphene_rect_t bounds;
-      GdkRGBA margin_color  = {0.3, 0.3, 0, 0.6};
-      GdkRGBA padding_color = {0.3, 0, 0.3, 0.6};
+      GdkRGBA widget_margin_color = {0.7, 0,   0, 0.6};
+      GdkRGBA margin_color        = {0.7, 0.7, 0, 0.6};
+      GdkRGBA padding_color       = {0.7, 0, 0.7, 0.6};
 
       style = gtk_css_node_get_style (priv->cssnode);
       get_box_margin (style, &margin);
       get_box_border (style, &border);
       get_box_padding (style, &padding);
 
-      /* Margins */
+      /* Widget margins */
+      graphene_rect_init (&bounds,
+                          0, -priv->margin.top,
+                          priv->allocation.width, priv->margin.top);
+      gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin top");
+
+      graphene_rect_init (&bounds,
+                          0, priv->allocation.height,
+                          priv->allocation.width, priv->margin.bottom);
+      gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin bottom");
+
+      graphene_rect_init (&bounds,
+                          -priv->margin.left, 0,
+                          priv->margin.left, priv->allocation.height);
+      gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin left");
+
+      graphene_rect_init (&bounds,
+                          priv->allocation.width, 0,
+                          priv->margin.right, priv->allocation.height);
+      gtk_snapshot_append_color (snapshot, &widget_margin_color, &bounds, "Widget margin right");
+
+
+      /* CSS Margins */
       graphene_rect_init (&bounds,
                           0, 0,
                           priv->allocation.width, margin.top);